﻿@model List<MileageStats.Web.Models.FillupListViewModel>
@{    
    ViewBag.Title = "Fill ups for " + ViewBag.VehicleName;
    var flattenedfillupListModel = new List<MileageStats.Web.Models.FillupViewModel>();
    foreach (var fillupListVM in Model)
    {
        flattenedfillupListModel.AddRange(fillupListVM.Fillups);
    } 
}
<div id="details-page">
    <div id="scrollable">
        <div>
            @{ Html.RenderAction("ListPartial", "Vehicle", new {vehicleId = ViewBag.VehicleId, isCollapsed = true}); }
        </div>
    </div>
    <div id="fixed">
        <div>
            <div id="info" class="framed article">
                <div>

                    <div id="details-pane" class="tab opened section">
                        @Html.ActionLink(" ", "Details", "Vehicle", new { id = Html.RouteValue("vehicleId") }, new { @class = "trigger" })
                    </div>
                    <div id="fillups-pane" class="tab opened section">
                        @Html.ActionLink(" ", "List", "Fillup", new { vehicleId = Html.RouteValue("vehicleId") }, new { @class = "trigger" })
                        <div class="content">
                            <div class="header">
                                @using (Html.BeginForm("Add", "Fillup", new { vehicleId = Html.RouteValue("vehicleId") }, FormMethod.Get))
                                {
                                    <button data-action="fillup-add-selected" class="button generic small" type="submit">
                                        <img src="~/Content/button-add.png" title="Add Fill up" alt="Add" />
                                    </button>
                                }
                            </div>
                            <div class="aside">
                                @Html.Partial("ListPartial", flattenedfillupListModel)
                            </div>
                            <div class="display article">
                                @{if (ViewBag.SelectedFillup != null)
                                { @Html.Partial("DetailsPartial", (MileageStats.Web.Models.FillupViewModel)ViewBag.SelectedFillup) }}
                            </div>
                        </div>
                    </div>
                    <div id="reminders-pane" class="tab section">
                        @Html.ActionLink(" ", "List", "Reminder", new { vehicleId = Html.RouteValue("vehicleId") }, new { @class = "trigger" })
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
